package cn.tradewin.advisor.components;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;

@Import(library="js/respond.min.js")
public class LayoutMaster {

	@Property
    @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
    private String title;
    
    @Property
    private String pageName;
	
	@Inject
	private ComponentResources resources;
	
	@Inject
	Messages messages;
	
	public String[] getAccounts() {
		return new String[] {"account/inbox","account/board"};
	}
	
	public String[] getSecurities() {
		return new String[] {"security/roleboard", "security/permboard"};
	}
	
	public String[] getMasters() {
		return new String[] {"master/codeboard","master/calendar", "master/deptboard", "master/taskboard", "master/jobboard"};
	}
	
	public String[] getWorkflows() {
		return new String[] {"workflow/VacationBoard","workflow/ApproveVacation"};
	}
	
	public String getNaviLabel() {
		return messages.get(pageName);
	}
	
	public String getNaviCss() {
		 return resources.getPageName().equalsIgnoreCase(pageName) ? "active" : null;
	}
}